// @ts-nocheck
import {ref} from "vue";
import type MenuItem from "element-plus/es/components/menu/src/utils/menu-item";
import router from "@/router";

// 创建菜单项数组
type MenuItem = {
    name: string;
    isActive: boolean;
    url_name: string;
};

export const menuItems = ref<MenuItem[]>([
    {name: 'Web', url_name: '/CTF', isActive: true},
    {name: 'Pwn', url_name: '/CTF/pwn', isActive: false},
    {name: 'Crypto', url_name: '/CTF/crypto', isActive: false},
    {name: 'Misc', url_name: '/CTF/misc', isActive: false},
])

export const setActiveCTF = async (item: MenuItem) => {
    menuItems.value.forEach((menuItem) => {
        menuItem.isActive = menuItem === item;
    });
    await router.push({path: item.url_name});
};
